<?php

namespace App\Resository;

use Hyperf\RpcClient\AbstractServiceClient;

class CalculatorServiceConsumer extends CommonService implements CalculatorServiceInterface
{
    /**
     * 定义对应服务提供者的服务名称
     * @var string
     */
    protected $serviceName = 'CalculatorService';

    /**
     * 定义对应服务提供者的服务协议
     * @var string
     */
    protected $protocol = 'jsonrpc';

    public $check;

    /**
     * 两数相加
     * @param int $a
     * @param int $b
     * @return int  $a + $b
     */
    public function add(int $a, int $b): int
    {
        var_dump(__FUNCTION__);
        $data =  $this->__request(__FUNCTION__, compact('a', 'b'));
        return $this->out(200,$data);
    }

    /**
     * 两数相减
     * @param int $a
     * @param int $b
     * @return int $a - $b
     */
    public function reduce(int $a, int $b): int
    {
        $data = $this->__request(__FUNCTION__, compact('a', 'b'));
        return $this->out(200,$data);
    }


}
